package com.lifesting.front;

import java.io.IOException;

import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
//Filter控件，过滤表格数据
public class Filter extends UIComponentBase implements ITableAware, ITextAware{

    public static final String COMPONENT_TYPE = "com.lifesting.filter";
    public static final String COMPONENT_FAMILY = "com.lifesting.family";
	private String tableFor;
	private String text; //显示在左边的
	

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	@Override
	public void encodeBegin(FacesContext context) throws IOException {
		super.encodeBegin(context);
	}
	public String getTableFor() {
		return tableFor;
	}

	public void setTableFor(String tableFor) {
		this.tableFor = tableFor;
	}

	@Override
	public String getFamily() {
		return COMPONENT_FAMILY;
	}
	private Object[] values;
	@Override
	public Object saveState(FacesContext context) {
		values = new Object[3];
		values[0] = super.saveState(context);
		values[1] = tableFor;
		values[2] = text;
		return values;
		
	}
	@Override
	public void restoreState(FacesContext context, Object state) {
		values = (Object[]) state;
		super.restoreState(context, values[0]);
		tableFor = (String) values[1];
		text = (String) values[2];
	}
}
